﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Com.VikingErik.Mvc.ResumingDownloads
{
    public enum PreconditionType : short
    {
        IfMatch,
        IfModifiedSince,
        IfNoneMatch,
        IfRange,
        IfUnmodifiedSince
    }

    public abstract class PreconditionBase
    {
        public PreconditionType Type { get; set; }
        protected object ValueObject { get; set; }

        public abstract object Value { get; set; }
    }

    public class Precondition<T> : PreconditionBase
    {
        public Precondition(PreconditionType type, T value)
        {
            Type = type;
            Value = value;
        }

        public override object Value
        {
            get
            {
                return (T)ValueObject;
            }
            set
            {
                ValueObject = (T)value;
            }
        }
    }

}
